<?php

class Silk_Mapi_Block_Adminhtml_Version_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
{
    public function __construct()
    {
        parent::__construct();
        $this->_objectId = "id";
        $this->_blockGroup = "mapi";
        $this->_controller = "adminhtml_version";
        $this->_updateButton("save", "label", Mage::helper("mapi")->__("Save Item"));
        $this->_updateButton("delete", "label", Mage::helper("mapi")->__("Delete Item"));

        $this->_addButton("saveandcontinue", array(
            "label" => Mage::helper("mapi")->__("Save And Continue Edit"),
            "onclick" => "saveAndContinueEdit()",
            "class" => "save",
        ), -100);

        $this->_formScripts[] = "

							function saveAndContinueEdit(){
								editForm.submit($('edit_form').action+'back/edit/');
							}
						";
    }

    public function getHeaderText()
    {
        if (Mage::registry("manufacturer_data") && Mage::registry("manufacturer_data")->getId()) {
            return Mage::helper("mapi")->__("Edit Item '%s'", $this->htmlEscape(Mage::registry("manufacturer_data")->getId()));
        } else {
            return Mage::helper("mapi")->__("Add Item");
        }
    }
}